@extends("admin.base")
@section("contents")
    <div class="row mt-5" style="font-family: 'UKIJ Ekran'">

        <div class="col-lg-4 mt-5 m-auto">
            <div class="card mb-3" style="border-radius: 10px">
                <div class="card-body w-100  " >
                    <h3 style="text-align: center" class="danger">添加电影国家类别页面</h3>
                    <form id="countryform" method="post">
                        <div class="m-auto  col-10 ">
                            <div class="row">
                                <div class="col-10 m-auto">
                                    <div class="mb-3">

                                        <input class="form-control " type="hidden" name="id" value="{{isset($country)?$country->id:''}}">

                                        <label class="form-label" for="default-input">国家类别</label>
                                        <input class="form-control " type="text" name="language_ch" value="{{isset($country)?$country->country_ch:''}}">
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-10 m-auto">
                                    <div class="mb-3">
                                        <label class="form-label" for="default-input">دۆلەت ئايرىمسى</label>
                                        <input class="form-control" type="text" name="language_uy" value="{{isset($country)?$country->country_uy:''}}">
                                    </div>
                                </div>
                            </div>
                            <div class="row">
                                <div class="col-10 m-auto">
                                    <div class="mb-3">
                                        <label class="form-label" for="default-input">排序</label>
                                        <input class="form-control" type="text" name="order" value="{{isset($country)?$country->order:''}}">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                    <div class="col-4 m-auto">
                        <button onclick="countrysubmit()" class="btn btn-outline-info">提交</button>
                        &nbsp; &nbsp; &nbsp;
                        <button type="reset" class="btn btn-outline-danger">重置</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
            @endsection


            @section("scripts")
                <script>
                    function countrysubmit() {
                        var data = $('#countryform').serialize()
                        $.ajax({
                            url: "insertcountry",
                            dataType: "json",
                            data: data,
                            async: true,
                            type: "GET",
                            headers: {'X-CSRF-TOKEN': '{{csrf_token()}}'},
                            success: function (req) {
                                swal({
                                    title: "操作成功",
                                    text: req.title,
                                    icon: "success",
                                    button: "知道了",
                                });
                                setTimeout(function () {
                                    location.href = "countrys";
                                }, 1000)
                            }
                        })
                    }
                </script>
@endsection

